﻿
namespace Quotation
{
    /// <summary>
    /// 买卖方向
    /// </summary>
    public sealed class BSType : StrictFlagBase<string, BSType>
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="value"></param>
        private BSType(string value) : base(value) { }
        
        /// <summary>
        /// 表示买方向
        /// </summary>
        public static readonly BSType Buy = new BSType("B");

        /// <summary>
        /// 表示卖方向
        /// </summary>
        public static readonly BSType Sell = new BSType("S");

        /// <summary>
        /// 隐式类型转换
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static implicit operator BSType(string value)
        {
            if (value == null)
                return default(BSType);
            else
            { 
                BSType rtn;
                BSType.TryConvert(value, out rtn);
                return rtn;
            }
        }
    }
}
